home *** CD-ROM | disk | FTP | other *** search
/ MacWorld 2003 August / MW 8 2003 CD1.iso / Inside Macworld / Product News / gimp-1.2.4.sit / gimp-1.2.4 / devel-docs / libgimp / sgml / gimpsignal.sgml < prev    next >
Encoding:
Text File  |  2003-05-20  |  5.4 KB  |  144 lines

  1. <refentry id="libgimp-gimpsignal" revision="19 Jan 2001">
  2. <refmeta>
  3. <refentrytitle>gimpsignal</refentrytitle>
  4. <manvolnum>3</manvolnum>
  5. <refmiscinfo>LIBGIMP Library</refmiscinfo>
  6. </refmeta>
  7.  
  8. <refnamediv>
  9. <refname>gimpsignal</refname><refpurpose>Portable signal handling.</refpurpose>
  10. </refnamediv>
  11.  
  12. <refsynopsisdiv><title>Synopsis</title>
  13. <synopsis>
  14.  
  15.  
  16.  
  17. #define     <link linkend="SA-RESTART-CAPS">SA_RESTART</link>
  18. void        (<link linkend="GimpSignalHandlerFunc">*GimpSignalHandlerFunc</link>)        (<link linkend="gint">gint</link> signum);
  19. <link linkend="GimpSignalHandlerFunc">GimpSignalHandlerFunc</link> <link linkend="gimp-signal-private">gimp_signal_private</link>   (<link linkend="gint">gint</link> signum,
  20.                                              <link linkend="GimpSignalHandlerFunc">GimpSignalHandlerFunc</link> handler,
  21.                                              <link linkend="gint">gint</link> flags);
  22. #define     <link linkend="gimp-signal-syscallrestart">gimp_signal_syscallrestart</link>      (signum,handler)
  23. </synopsis>
  24. </refsynopsisdiv>
  25.  
  26.  
  27.  
  28.  
  29.  
  30. <refsect1>
  31. <title>Description</title>
  32. <para>
  33. Portable signal handling.
  34.  
  35. </para>
  36. </refsect1>
  37.  
  38. <refsect1>
  39. <title>Details</title>
  40. <refsect2>
  41. <title><anchor id="SA-RESTART-CAPS">SA_RESTART</title>
  42. <programlisting>#define SA_RESTART SA_SYSV
  43. </programlisting>
  44. <para>
  45. This is just an alias for systems which do not define SA_RESTART.
  46. </para></refsect2>
  47. <refsect2>
  48. <title><anchor id="GimpSignalHandlerFunc">GimpSignalHandlerFunc ()</title>
  49. <programlisting>void        (*GimpSignalHandlerFunc)        (<link linkend="gint">gint</link> signum);</programlisting>
  50. <para>
  51. A prototype for signal handler functions. Note that each function which
  52. takes or returns a variable of this type also accepts or may return
  53. special values defined by your system's signal.h header file (like
  54. <parameter>SIG_DFL</parameter> or <parameter>SIG_IGN</parameter>).
  55. </para><informaltable pgwide=1 frame="none" role="params">
  56. <tgroup cols="2">
  57. <colspec colwidth="2*">
  58. <colspec colwidth="8*">
  59. <tbody>
  60. <row><entry align="right"><parameter>signum</parameter> :</entry>
  61. <entry>The number of the signal. Useful if different signals are handled
  62.          by a single handler.
  63.  
  64.  
  65. </entry></row>
  66. </tbody></tgroup></informaltable></refsect2>
  67. <refsect2>
  68. <title><anchor id="gimp-signal-private">gimp_signal_private ()</title>
  69. <programlisting><link linkend="GimpSignalHandlerFunc">GimpSignalHandlerFunc</link> gimp_signal_private   (<link linkend="gint">gint</link> signum,
  70.                                              <link linkend="GimpSignalHandlerFunc">GimpSignalHandlerFunc</link> handler,
  71.                                              <link linkend="gint">gint</link> flags);</programlisting>
  72. <para>
  73. This function furnishes a workalike for signal(2) but
  74. which internally invokes sigaction(2) after certain
  75. sa_flags are set; these primarily to ensure restarting
  76. of interrupted system calls. See sigaction(2)  It is a 
  77. aid to transition and not new development: that effort 
  78. should employ sigaction directly. [gosgood 18.04.2000] 
  79. </para>
  80. <para>
  81. Cause <parameter>handler</parameter> to be run when <parameter>signum</parameter> is delivered.  We
  82. use sigaction(2) rather than signal(2) so that we can control the
  83. signal handler's environment completely via <parameter>flags</parameter>: some signal(2)
  84. implementations differ in their sematics, so we need to nail down
  85. exactly what we want. [austin 06.04.2000]</para>
  86. <para>
  87.  
  88. </para><informaltable pgwide=1 frame="none" role="params">
  89. <tgroup cols="2">
  90. <colspec colwidth="2*">
  91. <colspec colwidth="8*">
  92. <tbody>
  93. <row><entry align="right"><parameter>signum</parameter> :</entry>
  94. <entry> Selects signal to be handled see man 5 signal (or man 7 signal)
  95. </entry></row>
  96. <row><entry align="right"><parameter>handler</parameter> :</entry>
  97. <entry> Handler that maps to signum. Invoked by O/S. 
  98. Handler gets signal that caused invocation. Corresponds
  99. to the <parameter>sa_handler</parameter> field of the <parameter>sigaction</parameter> struct.
  100. </entry></row>
  101. <row><entry align="right"><parameter>flags</parameter> :</entry>
  102. <entry> Preferences. OR'ed SA_<xxx>. See man sigaction. Corresponds
  103. to the <parameter>sa_flags</parameter> field of the <parameter>sigaction</parameter> struct.
  104. </entry></row>
  105. <row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry> A reference to the signal handling function which was
  106. active before the call to <link linkend="gimp-signal-private">gimp_signal_private</link>().
  107. </entry></row>
  108. </tbody></tgroup></informaltable></refsect2>
  109. <refsect2>
  110. <title><anchor id="gimp-signal-syscallrestart">gimp_signal_syscallrestart()</title>
  111. <programlisting>#define gimp_signal_syscallrestart(signum,handler) gimp_signal_private ((signum), (handler), SA_RESTART)
  112. </programlisting>
  113. <para>
  114. Installs a signal handler in a way that system calls which were not finished
  115. at the time of signal handler invocation will be silently restarted
  116. by the system (without failing with an error of EINTR).
  117. </para><informaltable pgwide=1 frame="none" role="params">
  118. <tgroup cols="2">
  119. <colspec colwidth="2*">
  120. <colspec colwidth="8*">
  121. <tbody>
  122. <row><entry align="right"><parameter>signum</parameter> :</entry>
  123. <entry>The number of the signal.
  124. </entry></row>
  125. <row><entry align="right"><parameter>handler</parameter> :</entry>
  126. <entry>The signal handler.
  127.  
  128.  
  129. </entry></row>
  130. </tbody></tgroup></informaltable></refsect2>
  131.  
  132. </refsect1>
  133.  
  134.  
  135.  
  136. <refsect1>
  137. <title>See Also</title>
  138. <para>
  139. signal(2), signal(5 or 7), sigaction(2).
  140. </para>
  141. </refsect1>
  142.  
  143. </refentry>
  144.